import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import moment from "moment"
Vue.prototype.$moment = moment;
//引入swiper组件
import VAS from 'vue-awesome-swiper'
Vue.use(VAS)
import 'swiper/css/swiper.css'
//引入elementUI组件
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
//引入axios
import axios from 'axios'
import VueAxios from 'vue-axios'
Vue.use(VueAxios, axios)
axios.defaults.baseURL = 'http://127.0.0.1:3000/cake'
// 全局的指令
// 参数1: 指令名    参数2:指令的函数
Vue.directive('src', function (el, bindings) {
  el.src = 'http://localhost:3000/' + bindings.value
})

Vue.config.productionTip = false

router.afterEach((to,form,next)=>{
  window.scrollTo(0,0)
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
